package alibaba.nulldemo.NullObjectPattern.demo02;

import alibaba.nulldemo.NullObjectPattern.Action;
import alibaba.nulldemo.NullObjectPattern.ActionImpl;
import alibaba.nulldemo.NullObjectPattern.Parser;

/**
 * @author ChangLiang
 * @date 2020/4/21
 */
public class ParserImplV2 implements Parser {

    private static Action DO_NOTHING = () -> {

    };

    @Override
    public Action findAction(String userInput) {
        Action action = DO_NOTHING;
        switch (userInput){
            case "do A":
                System.out.println("do A");
                action = new ActionImpl();
                break;
            case "do B":
                System.out.println("do B");
                action = new ActionImpl();
                break;
            default:
                break;
        }
        return action;
    }
}
